<template>
  <view>
      <!--日期picker-->
    <u-input 
     type="select" 
     :select-open="pickerShow" 
     v-model="datetime" 
     placeholder="请选择日期"
     v-if="!formObj.value"
      @click="chooseDate">
      </u-input>
      <text>
          {{formObj.value}}
      </text>
	<u-picker mode="time" v-model="pickerShow" @confirm="dateConfirms"></u-picker>
  </view>

</template>

<script>

export default {

    props: {
         formObj: {
            type: Object,
            
        }
    },

    data () {
        return {
             pickerShow: false,
            datetime: '',
            dateTimeObj: {}
        }
    },

    mounted() {

       
        this.dateTimeObj = this.formObj

       

    },

    methods:{

        chooseDate(){
            this.pickerShow = true
        },

            dateConfirms(e) {
                
                // console.log(moment(1584720182000).format('YYYY'))               
                this.datetime =  e.year + '-' + e.month + '-' + e.day;
                var obj = {
                    key: this.dateTimeObj.name,
                    value:this.datetime
                }
                this.$emit('childFn',obj)

                
            }

    }

}
</script>

<style>

</style>